import type { ResType, DetailType } from "@/types/details/detail";
import { request } from "@/utils/request";
import { ref } from "vue";
//获取商品详情页数据
export function getDetailAPI(id: string | string[]) {
  return request<ResType<DetailType>>({
    url: `/goods`,
    method: "get",
    params: {
      id,
    },
  });
}
type data = {
  id: string | string[];
  type: number | undefined;
  limit?: number;
};
type ResTypev<T> = {
  code: number;
  result: T;
  msg: string;
};
export type HotDate = {
  id: string;
  name: string;
  picture: string;
  price: number;
  sale: number;
  pinyin: string;
  type: number;
  desc: string;
  tags: string[];
};
export function getHotGoodsAPI({ id, type, limit = 3 }: data) {
  return request<ResTypev<HotDate[]>>({
    url: `/goods/hot`,
    method: "get",
    params: {
      id,
      type,
      limit,
    },
  });
}
